package com.example.casper.Experiment2024.data;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.widget.ImageView;
import androidx.appcompat.app.AppCompatActivity;
import com.example.casper.Experiment2024.R;

public class FullScreenImageActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_full_screen_image);

        ImageView fullScreenImageView = findViewById(R.id.fullScreenImageView);
        Intent intent = getIntent();
        if (intent != null) {
            String imageUriString = intent.getStringExtra("imageUri");
            if (imageUriString != null) {
                boolean contains = imageUriString.matches("^\\d+$");
                if(contains)
                {
                    fullScreenImageView.setImageResource(Integer.parseInt(imageUriString));
                }
                else fullScreenImageView.setImageURI(Uri.parse(imageUriString));
            }
        }
        fullScreenImageView.setOnClickListener(v -> finish());
    }
}